import { getStrategyById } from '@/api/network'
import { ref } from 'vue'

export default () => {
  // 获取策略加载
  const getStrategyLoading = ref(false)

  // 策略详情
  const strategyDetail = ref<null | NetworkStrategyDetailById>(null)

  /**
   * 获取策略
   * @param {string} networkId - 部门id
   */
  const getStrategy = async (networkId: string) => {
    getStrategyLoading.value = true
    const res = await getStrategyById(networkId)
    getStrategyLoading.value = false
    strategyDetail.value = res.data.data.row
  }

  return {
    strategyDetail,
    getStrategyLoading,
    getStrategy,
  }
}
